from flask import Flask
from config import config_map

def create_app(dev_name):
    app = Flask(__name__)
    config_class = config_map.get(dev_name)
    app.config.from_object(config_class) # 从类中读取需要的信息
    # 注册蓝图
    from app import main  # 导入包

    app.register_blueprint(main.main)  # 绑定包里面的蓝图对象

    return app